|
|
|
| |
|
|
|
|
Associating a control on a form to a field in a data table is referred to as binding a control. When they are assigned to a data source, these controls are called bound input controls. |
|
|
|
|
|
|
|
|
|
|
Let's add the first bound input control to the Titles table input form. Place an input control on the form by double-clicking the textbox control in the Visual Basic 5 toolbox. This inserts a textbox control directly in the center of the form. When the control is on the form, you can use the mouse to move and resize it in any way you choose. You could add additional input controls by double-clicking the textbox button in the toolbox as many times as you like. Set the Name property of this control to txtTitle. Add a label to describe this control by double-clicking the Label control. Set the label's Name property to lblTitle, and the Caption property to Title. Refer to Figure 1.1 if you have any problems finding a particular Visual Basic control. |
|
|
|
|
| |
|
|
|
|
When double-clicking controls onto a form, each instance of the control is loaded in the center of the form. When you add several controls in this manner, each control is loaded in exactly the same place on the form, like a stack of pancakes. It looks as though you still only have one, but they're all there! You can view each of the controls you loaded on your form by using the mouse to drag and drop the top-most control to another portion of the form. |
|
|
|
|
|
|
|
|
|
|
Setting the DataSource and DataField Properties |
|
|
|
|
|
|
|
|
You must set two textbox properties in order for the textbox control to interact with the data control. These are the two required properties: |
|
|
|
|
| | | |
|
|
|
|
Name of the field in the table |
|
|
|
|
|
|
|
|
|
|
A relationship is established between a field (the DataField property) in a table (the DataSource property) and a bound control when you set these two properties. When this is done, all data display and data entry in this input control is linked directly to the data table/field you selected. |
|
|
|
|
|